﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="cn_member_center_send_message" Codebehind="send_message.aspx.cs" %>


<%@ Register Src="../UserControl/header.ascx" TagName="header" TagPrefix="uc1" %>
<%@ Register Src="../UserControl/top_ad.ascx" TagName="top_ad" TagPrefix="uc2" %>
<%@ Register Src="../UserControl/member_menu.ascx" TagName="member_menu" TagPrefix="uc3" %>
<%@ Register Src="../UserControl/footer.ascx" TagName="footer" TagPrefix="uc4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>发送消息，<%=(new Gift.WebApp.BasicSet()).TitleBind() %></title>
    <meta name="Keywords" content="<%=(new Gift.WebApp.BasicSet()).KeywordBind() %>" />
    <meta name="Description" content="<%=(new Gift.WebApp.BasicSet()).DescriptionBind() %>" />
    <link href="/script/css/public.css" type="text/css" rel="stylesheet" />
    <link href="/script/css/member.css" type="text/css" rel="stylesheet" />
    <link href="/script/css/ie.css" type="text/css" rel="stylesheet" />

    <script language="Javascript" type="text/javascript" src="/script/js/jquery-1.6.2.min.js"></script>

    <!--登陆注册 弹出窗口-->
    <style type="text/css" media="all">
        @import "/script/js/login/thickbox.css";
    </style>

    <script src="/script/js/login/thickbox.js" type="text/javascript"></script>
    
     <link href="/script/art_dialog/skins/idialog.css" rel="stylesheet" />

    <script type="text/javascript" src="/script/art_dialog/artDialog.js"></script>

    <script type="text/javascript" src="/script/art_dialog/plugins/iframeTools.source.js"></script>

    <script type="text/javascript" src="/script/js/art_dialog.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#btnSendMessageSubmit").click(function () {
                if ($("input[name='radioType']:checked").val() == "0") {
                    if ($("#txtAddressee").val() == "") {
                        $("#txtAddressee").select();
                        $("#spAddressee").html("<img src=\"/script/images/wrong.gif\" />请输入用户名！");
                        return false;
                    } else {
                        $("#spAddressee").html("<img src=\"/script/images/right.gif\"/>");
                    }
                } else $("#spAddressee").html("");
                if ($("#txtTitle").val() == "") {
                    $("#txtTitle").select();
                    $("#spTitle").html("<img src=\"/script/images/wrong.gif\" />请输入标题！");
                    return false;
                } else $("#spTitle").html("<img src=\"/script/images/right.gif\"/>");
                if ($("#txtaContent").val() == "") {
                    $("#txtaContent").select();
                    $("#spContent").html("<img src=\"/script/images/wrong.gif\" />请输入内容！");
                    return false;
                } else $("#spContent").html("<img src=\"/script/images/right.gif\"/>");
                var addressee = "";
                if ($("input[name='radioType']:checked").val() == "0") addressee = $("#txtAddressee").val();
                else addressee = "管理员";

                $.ajax({
                    type: "POST",
                    url: "send_message.ashx",
                    data: "addressee=" + addressee + "&title=" + escape($("#txtTitle").val()) + "&content=" + escape($("#txtaContent").val()) + "&option=" + $("input[name='radioOption']:checked").val(),
                    success: function (msg) {
                        if (msg == "0") {
                            $("#txtAddressee").select();
                            art.dialog.tips("收件人不允许为自己！", 1.5);
                            return false;
                        }
                        else if (msg == "1") {
                            $("#txtAddressee").select();
                            art.dialog.tips("用户名不存在！", 1.5);
                            return false;
                        }
                        else if (msg == "2") {
                            art.dialog.tips("恭喜您，发送成功！", 1.5);
                            setTimeout("window.location.href='out_box.html'", 2000);
                        }
                        else if (msg == "3") {
                            art.dialog.tips("很抱歉，发送失败！", 1.5);
                        }
                        else if (msg == "4") {
                            art.dialog.tips("恭喜您，保存成功！", 1.5);
                            setTimeout("window.location.href='draft_box.html'", 2000);
                        } else if (msg == "5") art.dialog.tips("保存失败！", 1.5);
                    }
                });
                return false;
            });
            $("input[name='radioType']").change(function () {
                if ($("input[name='radioType']:checked").val() == "0") {
                    $("#pAddressee").css("display", "block");
                } else $("#pAddressee").css("display", "none");
            });
        });
    </script>

</head>
<body>
    <uc1:header ID="Header1" runat="server" />
    <uc2:top_ad ID="Top_ad1" runat="server" />
    <div class="container">
        <uc3:member_menu ID="Member_menu1" runat="server" />
        <!--end leftnav-->
        <div class="rightcontent">
            <div class="content no_border">
                <form id="formSendMessage" action="" method="post" defaultbutton="btnSendMessageSubmit">
                    <h5>
                        <strong>发送消息</strong></h5>
                    <%Response.Write(SendMessageBind()); %>
                    <p class="radio_input">
                        <label>
                            发送选项：</label><input id="radioOption0" type="radio" name="radioOption" class="radio"
                                value="0" checked="checked" />立即发送&nbsp;<input id="radioOption1" type="radio" class="radio"
                                    name="radioOption" value="1" />保存到草稿箱</p>
                    <input id="btnSendMessageSubmit" class="submit" type="submit" value="提  交" />
                </form>
            </div>
        </div>
        <!--end rightcontent-->
        <span class="clear"></span>
    </div>
    <uc4:footer ID="Footer1" runat="server" />
</body>
</html>
